package site.zhoulei.springbootstu.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import site.zhoulei.springbootstu.model.Article;

import java.util.logging.Logger;

/**
 * @author zlleige
 * @create 2020-07-29 9:03
 */
@Slf4j  //lombok插件功能
@RestController //@Controller和@ResponseBody结合。它有两层含义：ResponseBody的作用，请求响应默认使用的序列化方式是JSON，
public class HelloController {
    //有了slf44j 无需创建
    //private static final Logger log = Logger.getLogger(HelloController.class);
    @RequestMapping("/hello")
//    public String hello(String name){
//        //测试hello
//        return "hello world" + name;
//    }
    public Article hello(){
        //测试hello
        Article article = Article.builder().id(4L).author("zl").build();
        log.info("测试slf4j日志 （基于Lombok--热部署）" + article);
        return article;
    }
}
